<template>
  <div class="search">
    <f-form ref="form" :action="api.busOrder" :form-key="this.formItem.orderId">
      <a-divider orientation="left">
        订单附件资料
      </a-divider>
      <f-form-item type="upload" name="orderImage" :value="formItem.orderImage" :file-max="20" :disabled="readOnly" :busId="orderId" busType="Order" :realRemove="true"/>

    </f-form>
  </div>
</template>
<script>
  import api from './js/api'


  export default {
    name: 'OrderAttachment',
    props: {},
    data() {
      return {
        refs: this.$refs,
        orderId: '',
        readOnly: false,
        api: Object.assign(api, this.api),
        isAdd: true,//是否是添加模式
        loaded: false,//是否加载完成
        formItem: this.getFormItem()
      }
    },
    methods: {
      getFormItem() {
        return {
          orderId: '',
          remark: '',
          orderImage: []
        }
      },

      //表单赋值
      setData(data, readOnly) {
        if (readOnly) {
          this.readOnly = readOnly
        }
        this.$refs.form.resetFields()
        this.formItem = this.getFormItem()
        if (data && data.orderId) {
          let params = {
            orderId: data.orderId
          }
          this.orderId = data.orderId
          this.refs['form'].getDetails(params, (data) => {
            this.formItem = data
            this.loaded = true
          })
          this.isAdd = false
        } else {
          this.loaded = true
        }
      },

    },
    mounted() {

    },
    created() {
    },
    components: {
    }
  }
</script>

<style scoped lang="less" rel="stylesheet/less">

</style>
